package com.thiswhyme.seata.storage.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.thiswhyme.seata.storage.domain.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author: thiswhyme
 * @date: 2020/9/4
 */
public interface ProductMapper extends BaseMapper<Product> {

    @Update("UPDATE t_product SET stock = stock - #{amount} WHERE id = #{productId}")
    Integer reduceStock(@Param("productId") Long productId, @Param("amount") Integer amount);
}
